package org.anjan.dp.abstractfactory.shipimpl;

import org.anjan.dp.abstractfactory.Ship;
import org.anjan.dp.abstractfactory.ShipFactory;

public class PetrolShip extends Ship {
    //Tell that we will construct the ship with a factory
    private ShipFactory shipFactory;

    //The parts required are given by this factory
    public PetrolShip(ShipFactory factory) {
        this.shipFactory = factory;
    }

    @Override
    protected void makeShip() {
        System.out.println("Making petrol ship = " + getName());
        turbo = shipFactory.getTurbo();
        engine = shipFactory.getEngine();
        System.out.println("Engine : " + engine + " , Turbo : " + turbo);
    }
}
